<!--
 * @Description:    
 * @Author: 史迪仔
 * @Date: 2024-11-11 19:50:03
 * @LastEditors: 史迪仔
 * @LastEditTime: 2024-11-11 19:50:52
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial￾scale=1.0">
    <title>DOM1</title>
    </head>
    <body>
    <img id="h1" src="img/off.gif"> <br><br>
    <div class="cls">杰普软件</div> <br>
    <div class="cls">Java程序员</div> <br>
    <input type="checkbox" name="hobby"> 电影
    <input type="checkbox" name="hobby"> 旅游
    <input type="checkbox" name="hobby"> 游戏
    </body>
    <script>
    var img = document.getElementById('h1');
    img.src = "D:\\Users\\86156\\Desktop\\HTNL-CSS-JS-Vue\\day51\\img\\on.gif";
    var divs = document.getElementsByTagName('div');
    for (let i = 0; i < divs.length; i++) {
        const div = divs[i];
        div.innerHTML += " <font color='red'>very good</font>";
    }
    var ins = document.getElementsByName('hobby');
    for (let i = 0; i < ins.length; i++) {
        const check = ins[i];
        check.checked = true;//选中
    }
</script>
</html>